<%--
  Created by IntelliJ IDEA.
  User: jiao
  Date: 2019/5/25
  Time: 11:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="utf-8">
    <title>主页</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/resource/layui/css/layui.css">
    <link rel="stylesheet" href="/resource/css/global.css">
    <link rel="stylesheet" href="/resource/css/common.css">

</head>
<body>
<!--导航栏由此开始-->
<div class="fly-header layui-bg-green">
    <div class="layui-container">
        <a class="fly-logo" href="/user/redirectIndex.do">
            <div class="layui-logo" style="font-size: 20px; color: #CAE1FF;"><span class="iconfont-ali icon-B" style="font-size: 35px"></span></div>
        </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
            <li class="layui-nav-item layui-this">
                <a href="/user/redirectIndex.do"><i class="layui-icon  layui-icon-home"></i>首页</a>
            </li>
        </ul>
        <ul class="layui-nav fly-nav-user ">
            <!-- 登入后的状态 -->
            <li class="layui-nav-item">
                <a class="fly-nav-avatar" href="/user/redirectIndex.do">
                    <cite class="layui-hide-xs">${user.userName }</cite>
                    <img <c:if test="${!empty user.headSculpture }">src="${user.headSculpture }"</c:if><c:if test="${empty user.headSculpture }">src="/resource/img/logo.JPG"</c:if> alt="${user.userName}">
                </a>
                <dl class="layui-nav-child layui-bg-green">
                    <dd><a href="/user/userindex.do"><i class="layui-icon">&#xe609;</i>用户中心</a></dd>
                    <dd><a href="/user/userset.do"><i class="layui-icon">&#xe620;</i>基本设置</a></dd>
                    <dd><a href="/user/usermessage.do"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>我的消息<c:if test="${havenoread==1 }"><span class="layui-badge-dot"></span></c:if></a></dd>
                    <dd><a href="/user/userhome.do"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;">&#xe68e;</i>我的主页</a></dd>
                    <hr style="margin: 5px 0;">
                    <dd><a href="/user/logout.do" ><i class="iconfont-ali icon-tuichu"></i>退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>
</div>
<!--导航栏到此结束-->
<!--二级标题栏开始-->
<div class="fly-panel fly-column">
    <div class="layui-container">
        <ul class="layui-clear">
            <li class="layui-hide-xs layui-this"><a href="/user/redirectIndex.do">首页</a></li>
            <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>

            <!-- 用户登入后显示 -->
            <c:if test="${user!=null }">
                <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block">
                    <a href="/user/userindex.do">我的</a>
                </li>
            </c:if>
        </ul>

        <div class="fly-column-right layui-hide-xs ">
            <span id="Bsearch" class="fly-search"><i class="layui-icon layui-icon-search"></i></span>
            <a href="/essay/eassyadd.do" class="layui-btn">发表新帖</a>
        </div>
    </div>
</div>
<!--二级标题栏结束-->
<div class="layui-container">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md13">
            <div class="fly-panel" style="margin-bottom: 0;">
                <!-- 文章由此循环 -->
                <c:if test="${!empty   essaylist }">
                    <c:forEach items="${essaylist }" var="essay">
                        <ul class="fly-list">
                            <li>
                                <a href="/user/otheruserhome.do?userName=${essay.user.userName }" class="fly-avatar">
                                    <img <c:if test="${!empty essay.user.headSculpture }">src="${essay.user.headSculpture }"</c:if><c:if test="${empty essay.user.headSculpture }"> src="/resource/img/logo.JPG"</c:if> alt="${essay.user.userName}">
                                </a>
                                <h2>
                                    <a class="layui-badge">${essay.label }</a>
                                    <a href="/essay/essaydetail.do?essayId=${essay.essayId }">${essay.title }</a>
                                </h2>
                                <div class="fly-list-info">
                                    <div >
                                        <span class="layui-badge layui-bg-red" id="otheruserName">${essay.user.userName }</span>
                                        <span class="layui-badge layui-bg-green layui-hide-xs">${essay.publishDate }</span>
                                    </div>
                                </div>
                                <div class="fly-list-badge">
                                    <span id="praise" name="ptcv" class="layui-icon layui-icon-praise" title="赞" essayId="${essay.essayId }">${essay.likeNumber }</span>
                                    <span class="fly-mid"></span>
                                    <span id="tread" name="ptcv"  class="layui-icon layui-icon-tread" title="踩" essayId="${essay.essayId }">${essay.treadNumber }</span>
                                    <span class="fly-mid"></span>
                                    <span id="comment" name="ptcv"  class="iconfont-ali icon-pinglun" title="评论" essayId="${essay.essayId }">${essay.commentNumber }</span>
                                    <span class="fly-mid"></span>
                                    <c:if test="${essay.integration==0 }">
                                        <span id="validity" name="ptcv"  class="iconfont-ali icon-dengji-" title="真实度" essayId="${essay.essayId }" userGrade="${essay.user.grade }">${essay.validity }%</span>
                                    </c:if>
                                    <c:if test="${essay.integration!=0 }">
                                        <span id=integration name="ptcv"  class="iconfont-ali icon-jifen" title="下载积分">${essay.integration }</span>
                                    </c:if>
                                </div>
                            </li>
                        </ul>
                    </c:forEach >
                    <!-- 文章到此循环结束 -->
                    <div style="text-align: center">
                        <div id="B_Page" >
                        </div>
                    </div>
                </c:if>
                <c:if test="${empty essaylist }">
                    <div class="fly-none">没有相关数据</div>
                </c:if>
            </div>
        </div>
    </div>
</div>

<div class="fly-footer">
    <p>Believe 社区 2019 &copy; 千夜 出品</p>
</div>
<input class="layui-hide" id="page" value="${currentPage}"></input>
<input class="layui-hide" id="otherUserId" value="${otherUserId}"></input>
<input class="layui-hide" id="TotalNumber" value="${essayListCount}"></input>
<script type="text/javascript" src="/resource/js/common.js"></script>
<script src="/resource/js/jquery-3.4.0.min.js"></script>
<script src="/resource/layui/layui.js"></script>
<script src="/resource/js/userAllEssay.js"></script>
<script>
    //检测session是否过期  或者未登录
    layui.use('layer',function(){
        $(document).ready(function(){
            var se="${user}";
            if(se==""){
                layer.alert('登录过期或未登录，请登录', function(index){
                    window.location.href="/login.html";
                    layer.close(index);
                });
            }
        });
    });
</script>
</body>
</html>
